(* Content-type: application/vnd.wolfram.mathematica *)

(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)

(* CreatedBy='Mathematica 10.4' *)

(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[       158,          7]
NotebookDataLength[     10819,        342]
NotebookOptionsPosition[      9438,        291]
NotebookOutlinePosition[      9772,        306]
CellTagsIndexPosition[      9729,        303]
WindowFrame->Normal*)

(* Beginning of Notebook Content *)
Notebook[{
Cell[BoxData[
 RowBox[{"Needs", "[", "\"\<MathToCpp`\>\"", "]"}]], "Input",
 CellChangeTimes->{{3.68322697348263*^9, 3.683226996228455*^9}, {
  3.698970938157037*^9, 3.698970939538197*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"a", "=", 
   RowBox[{"{", 
    RowBox[{
     RowBox[{"$y", "[", "1", "]"}], "+", 
     RowBox[{"$y", "[", "3", "]"}]}], "}"}]}], ";"}]], "Input",
 CellChangeTimes->{{3.6832287356596823`*^9, 3.683228748824398*^9}, {
  3.683229175457333*^9, 3.683229178569187*^9}, {3.69897232695074*^9, 
  3.698972328503495*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"y", "=", 
   RowBox[{"{", 
    RowBox[{
     RowBox[{"$y", "[", "1", "]"}], ",", 
     RowBox[{"$y", "[", "2", "]"}]}], "}"}]}], ";"}]], "Input",
 CellChangeTimes->{{3.699362342201551*^9, 3.6993623503705482`*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"subs", " ", "=", " ", 
   RowBox[{"{", 
    RowBox[{
     RowBox[{
      RowBox[{"$y", "[", "1", "]"}], "\[Rule]", " ", 
      RowBox[{"HoldForm", "@", 
       RowBox[{"x", "[", 
        RowBox[{"[", "0", "]"}], "]"}]}]}], ",", 
     RowBox[{
      RowBox[{"$y", "[", "3", "]"}], "\[Rule]", 
      RowBox[{"HoldForm", "@", 
       RowBox[{"x", "[", 
        RowBox[{"[", "1", "]"}], "]"}]}]}]}], "}"}]}], ";"}]], "Input",
 CellChangeTimes->{{3.683228752431229*^9, 3.683228790912715*^9}, {
  3.683229181521735*^9, 3.6832291845721283`*^9}, {3.683229777377143*^9, 
  3.683229779635003*^9}, {3.6832298188355*^9, 3.683229820826723*^9}, {
  3.6989723321443*^9, 3.6989723388310843`*^9}, {3.698980735273615*^9, 
  3.698980765592906*^9}}],

Cell[BoxData[
 RowBox[{"\[IndentingNewLine]", 
  RowBox[{
   RowBox[{"SetOptions", "[", 
    RowBox[{"CseWriteCpp", ",", "\n", "    ", 
     RowBox[{"ExportDirectory", "\[Rule]", 
      RowBox[{"NotebookDirectory", "[", "]"}]}], ",", "\n", "\t", 
     RowBox[{"ArgumentLists", "->", 
      RowBox[{"{", "x", "}"}]}], ",", "\n", "\t", 
     RowBox[{"ArgumentDimensions", "->", " ", 
      RowBox[{"{", 
       RowBox[{"{", 
        RowBox[{"2", ",", "1"}], "}"}], "}"}]}], ",", "\n", "\t", 
     RowBox[{"SubstitutionRules", "->", " ", "subs"}]}], "\n", "]"}], 
   ";"}]}]], "Input",
 CellChangeTimes->{{3.68322933409242*^9, 3.6832293344272223`*^9}, {
   3.683229758059367*^9, 3.683229761970862*^9}, 3.698980733298242*^9}],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Options", "[", "CseWriteCpp", "]"}]], "Input",
 CellChangeTimes->{{3.68322898178588*^9, 3.683228997608267*^9}}],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{
   RowBox[{
   "MathToCpp`Private`ExportDirectory", 
    "\[Rule]", \
"\<\"/home/ayonga/Dropbox/research/dzopt/frost/mathematica/Sources/MathToCpp/\
\"\>"}], ",", 
   RowBox[{"MathToCpp`Private`ArgumentLists", "\[Rule]", 
    RowBox[{"{", "x", "}"}]}], ",", 
   RowBox[{"MathToCpp`Private`ArgumentDimensions", "\[Rule]", 
    RowBox[{"{", 
     RowBox[{"{", 
      RowBox[{"2", ",", "1"}], "}"}], "}"}]}], ",", 
   RowBox[{"MathToCpp`Private`SubstitutionRules", "\[Rule]", 
    RowBox[{"{", 
     RowBox[{
      RowBox[{
       RowBox[{"$y", "[", "1", "]"}], "\[Rule]", 
       TagBox[
        RowBox[{"$x", "\[LeftDoubleBracket]", "0", "\[RightDoubleBracket]"}],
        HoldForm]}], ",", 
      RowBox[{
       RowBox[{"$y", "[", "3", "]"}], "\[Rule]", 
       TagBox[
        RowBox[{"$x", "\[LeftDoubleBracket]", "1", "\[RightDoubleBracket]"}],
        HoldForm]}]}], "}"}]}], ",", 
   RowBox[{
   "MathToCpp`Private`TemplateFile", 
    "\[Rule]", \
"\<\"/home/ayonga/Dropbox/research/dzopt/frost/mathematica/Sources/MathToCpp/\
MathToCpp/Template/template.cc\"\>"}], ",", 
   RowBox[{
   "MathToCpp`Private`TemplateHeader", 
    "\[Rule]", \
"\<\"/home/ayonga/Dropbox/research/dzopt/frost/mathematica/Sources/MathToCpp/\
MathToCpp/Template/template.hh\"\>"}], ",", 
   RowBox[{"MathToCpp`Private`Namespace", "\[Rule]", "\<\"symbolic\"\>"}], 
   ",", 
   RowBox[{"MathToCpp`Private`Behavior", "\[Rule]", "\<\"basic\"\>"}], ",", 
   RowBox[{"MathToCpp`Private`ExportHeaderFile", "\[Rule]", "False"}], ",", 
   RowBox[{"MathToCpp`Private`ExportFull", "\[Rule]", "True"}]}], 
  "}"}]], "Output",
 CellChangeTimes->{{3.683228988474084*^9, 3.683228998084847*^9}, {
   3.683229071555256*^9, 3.683229133786211*^9}, 3.6832291888521433`*^9, {
   3.683229744324416*^9, 3.683229781443357*^9}, 3.683229822733042*^9, 
   3.683229945422008*^9, 3.698972345509597*^9}]
}, Open  ]],

Cell[BoxData[
 RowBox[{
  RowBox[{"ExportToCpp", "[", 
   RowBox[{"\"\<a\>\"", ",", 
    RowBox[{"{", "a", "}"}], ",", 
    RowBox[{"{", "{"}]}]}], "]"}]], "Input",
 CellChangeTimes->{{3.683228804597375*^9, 3.683228889486244*^9}, {
  3.683228939105044*^9, 3.683228948088622*^9}, {3.683229017697275*^9, 
  3.683229023552804*^9}, {3.699362328319292*^9, 3.699362337353837*^9}}],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Map", "[", 
  RowBox[{"Symbol", ",", 
   RowBox[{"Table", "[", 
    RowBox[{
     RowBox[{"\"\<a\>\"", "<>", "\"\<$\>\"", "<>", 
      RowBox[{"ToString", "[", "i", "]"}], "<>", "\"\<$\>\"", "<>", 
      RowBox[{"ToString", "[", "j", "]"}]}], ",", 
     RowBox[{"{", 
      RowBox[{"i", ",", "3"}], "}"}], ",", 
     RowBox[{"{", 
      RowBox[{"j", ",", "2"}], "}"}]}], "]"}], ",", 
   RowBox[{"{", "2", "}"}]}], "]"}]], "Input",
 CellChangeTimes->{{3.6989727764490128`*^9, 3.698972820840497*^9}, {
  3.698972854956419*^9, 3.6989728607007427`*^9}, {3.698972916710086*^9, 
  3.69897293333176*^9}}],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{
   RowBox[{"{", 
    RowBox[{"a$1$1", ",", "a$1$2"}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"a$2$1", ",", "a$2$2"}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"a$3$1", ",", "a$3$2"}], "}"}]}], "}"}]], "Output",
 CellChangeTimes->{{3.6989728131853533`*^9, 3.698972822495512*^9}, 
   3.698972861321642*^9, {3.6989729197362967`*^9, 3.698972934044924*^9}}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Symbol", "[", "\"\<a$1$1\>\"", "]"}]], "Input",
 CellChangeTimes->{{3.698972888768083*^9, 3.698972892428492*^9}}],

Cell[BoxData["a$1$1"], "Output",
 CellChangeTimes->{3.698972892809815*^9}]
}, Open  ]],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{
   RowBox[{"{", 
    RowBox[{"a$1$1", ",", "a$1$2"}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"a$2$1", ",", "a$2$2"}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"a$3$1", ",", "a$3$2"}], "}"}]}], "}"}]], "Input"],

Cell[BoxData[
 RowBox[{"a", "=."}]], "Input",
 CellChangeTimes->{{3.6989733415561113`*^9, 3.6989733439862432`*^9}}],

Cell[BoxData[
 RowBox[{"a$1$1", "=."}]], "Input",
 CellChangeTimes->{{3.698973345928007*^9, 3.698973349169643*^9}, {
  3.698974628143943*^9, 3.698974628407452*^9}}],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"FindSymbols", "[", 
  RowBox[{"{", 
   RowBox[{
    RowBox[{"{", 
     RowBox[{"a$1$1", ",", "a$1$2"}], "}"}], ",", 
    RowBox[{"{", 
     RowBox[{"a$2$1", ",", "a$2$2"}], "}"}], ",", 
    RowBox[{"{", 
     RowBox[{"a$3$1", ",", "a$3$2"}], "}"}]}], "}"}], "]"}]], "Input",
 CellChangeTimes->{{3.698974632478313*^9, 3.6989746399110823`*^9}}],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{
  "a$1$1", ",", "a$1$2", ",", "a$2$1", ",", "a$2$2", ",", "a$3$1", ",", 
   "a$3$2"}], "}"}]], "Output",
 CellChangeTimes->{3.698974640336892*^9}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Symbol", "[", "\"\<a_\>\"", "]"}]], "Input",
 CellChangeTimes->{{3.6989779910782537`*^9, 3.698977996236751*^9}}],

Cell[BoxData[
 TemplateBox[{
  "Symbol","symname",
   "\"The string \\\"\\!\\(\\*RowBox[{\\\"\\\\\\\"a_\\\\\\\"\\\"}]\\)\\\" \
cannot be used for a symbol name. A symbol name must start with a letter \
followed by letters and numbers.\"",2,30,17,31737841636725893004,"Local"},
  "MessageTemplate"]], "Message", "MSG",
 CellChangeTimes->{3.698977996563925*^9}],

Cell[BoxData[
 RowBox[{"Symbol", "[", "\<\"a_\"\>", "]"}]], "Output",
 CellChangeTimes->{3.698977996566407*^9}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"b$", " ", "->", " ", 
  RowBox[{"HoldForm", "[", 
   RowBox[{
    RowBox[{"(", "b_", ")"}], "[", 
    RowBox[{"[", "1", "]"}], "]"}], "]"}]}]], "Input",
 CellChangeTimes->{{3.698980635495819*^9, 3.698980641927107*^9}},
 FormatType->"InputForm"],

Cell[BoxData[
 RowBox[{"b$", "\[Rule]", 
  TagBox[
   RowBox[{"b_", "\[LeftDoubleBracket]", "1", "\[RightDoubleBracket]"}],
   HoldForm]}]], "Output",
 CellChangeTimes->{3.698980636320026*^9}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"b$", "\[Rule]", 
  RowBox[{"HoldForm", "[", 
   RowBox[{"b_", "\[LeftDoubleBracket]", "1", "\[RightDoubleBracket]"}], 
   "]"}]}]], "Input",
 CellChangeTimes->{{3.6989806499132433`*^9, 3.698980667787451*^9}}],

Cell[BoxData[
 RowBox[{"b$", "\[Rule]", 
  TagBox[
   RowBox[{"b_", "\[LeftDoubleBracket]", "1", "\[RightDoubleBracket]"}],
   HoldForm]}]], "Output",
 CellChangeTimes->{3.698980655385297*^9}]
}, Open  ]],

Cell[BoxData[""], "Input",
 CellChangeTimes->{{3.698980677119041*^9, 3.698980680128809*^9}}]
},
WindowSize->{805, 876},
WindowMargins->{{Automatic, 0}, {240, Automatic}},
FrontEndVersion->"11.0 for Linux x86 (64-bit) (July 28, 2016)",
StyleDefinitions->"Default.nb"
]
(* End of Notebook Content *)

(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[558, 20, 189, 3, 35, "Input"],
Cell[750, 25, 345, 9, 32, "Input"],
Cell[1098, 36, 248, 7, 32, "Input"],
Cell[1349, 45, 764, 19, 32, "Input"],
Cell[2116, 66, 721, 16, 159, "Input"],
Cell[CellGroupData[{
Cell[2862, 86, 135, 2, 35, "Input"],
Cell[3000, 90, 1896, 46, 260, "Output"]
}, Open  ]],
Cell[4911, 139, 374, 8, 32, "Input"],
Cell[CellGroupData[{
Cell[5310, 151, 621, 15, 59, "Input"],
Cell[5934, 168, 396, 10, 32, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[6367, 183, 137, 2, 32, "Input"],
Cell[6507, 187, 74, 1, 30, "Output"]
}, Open  ]],
Cell[6596, 191, 253, 8, 32, "Input"],
Cell[6852, 201, 115, 2, 30, "Input"],
Cell[6970, 205, 164, 3, 30, "Input"],
Cell[CellGroupData[{
Cell[7159, 212, 366, 10, 32, "Input"],
Cell[7528, 224, 186, 5, 32, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[7751, 234, 136, 2, 33, "Input"],
Cell[7890, 238, 359, 7, 41, "Message"],
Cell[8252, 247, 111, 2, 32, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[8400, 254, 268, 7, 33, "Input"],
Cell[8671, 263, 192, 5, 32, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[8900, 273, 232, 5, 33, "Input"],
Cell[9135, 280, 192, 5, 32, "Output"]
}, Open  ]],
Cell[9342, 288, 92, 1, 30, "Input"]
}
]
*)

